package com.ckx.feign.fallback;

import com.ckx.feign.QQApi;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class QQApiFallback implements FallbackFactory<QQApi> {

    @Override
    public QQApi create(Throwable cause) {
        return new QQApi() {
            @Override
            public String get() {
                log.warn("熔断了, 原因: {}", cause.getMessage());
                return "熔断";
            }
        };

    }

}
